Skip to content

[RFC][utest] Add audio driver test framework #10243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1078249029
Copy link
Contributor

@1078249029 1078249029 commented May 3, 2025

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

Fixed #10046

你的解决方案是什么 (what is your solution)

Achieve driver framework by operating memory to simulate audio peripheral drivers. And it could be as a draft standrad for other drivers test framework.

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@1078249029 1078249029 requested a review from Rbb666 as a code owner May 3, 2025 14:32
@1078249029 1078249029 marked this pull request as draft May 3, 2025 14:32
int fd = -1;
int res = 0;
uint8_t *buffer = NULL;
void* player_buffer = NULL;struct rt_audio_caps caps = {0};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意下代码风格,加个换行吧

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个文件名称改成drv_xxx是不是更好些?

@1078249029 1078249029 force-pushed the audio_test branch 2 times, most recently from e83b1b6 to 2655d6a Compare May 10, 2025 04:37
Achieve driver framework by operating memory to simulate audio
peripheral drivers. And it could be as a draft standrad for other
drivers test framework.

Signed-off-by: 1078249029 <[email protected]>
@Rbb666
Copy link
Member

Rbb666 commented May 10, 2025

@1078249029 这个PR准备好了吗?

@1078249029
Copy link
Contributor Author

1078249029 commented May 10, 2025

@1078249029 这个PR准备好了吗?

准备好了,麻烦您review下。
但是ci过不去,应该是utest组件下没有分配reviewer的问题?

@1078249029 1078249029 requested a review from Rbb666 May 10, 2025 09:21
@1078249029
Copy link
Contributor Author

@unicornx 老师,上次跟您说的音频测试框架已经写好了,您有空的话也请review?

@Rbb666 Rbb666 requested a review from unicornx May 12, 2025 02:31
@Rbb666 Rbb666 closed this May 12, 2025
@Rbb666 Rbb666 reopened this May 12, 2025
Copy link

📌 Code Review Assignment


📊 Current Review Status (Last Updated: 2025-05-12 02:45 UTC)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

Copy link
Contributor

@unicornx unicornx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得上次开会满老师 @mysterywolf 说建议后面 ut cases 都移到各个模块自己的目录下去,不要放到 examples 下了,本身这个 examples 就很让人迷惑。可以参考 src/klibc/utest 这个是满老师最新作的 utest 例子,貌似就是每个模块下自己维护一个 utest 目录然后在里面加测试代码。然后就是模仿 src/klibc/utest 下的代码写,包括 SConscript 里要 denpend RT_UTEST_USING_ALL_CASES ,还有配置选项名字统一加 'RT_UTEST_TC_USING_' 前缀,参考 'RT_UTEST_TC_USING_KLIBC'。

还有一个问题就是建议在测试代码中以注释的方式写一下测试的设计思想,直接 review 代码一下子不知道你的设计思路理解起来很费劲。这个测试代码需要依赖硬件吗?看注释有模拟的部分,可以说明一下。另外我理解这里测试的对象是 driver audio 的 API,所以 drv_mic.cdrv_player.c 应该是测试的主体,对吧。可以在注释中列一下你覆盖的 API 吗?

代码上,所有全局变量和函数,如果不是 extern 的请全部 static。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] [doxygen] [audio] A plan to achieve audio components doxygen comments
3 participants